﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Zhp.Model.Common
{
    /// <summary>
    /// 统一返回格式
    /// </summary>
    public class ApiResult
    {
        /// <summary>
        /// 成功失败标识
        /// </summary>
        public int Status { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string Message { get; set; } = "请求成功！";

        /// <summary>
        /// 
        /// </summary>
        public string Url { get; set; }

        /// <summary>
        /// 返回数据
        /// </summary>
        public object Body { get; set; }
    }

    /// <summary>
    /// 
    /// </summary>
    public class BaseRet
    {
        /// <summary>
        /// 
        /// </summary>
        public bool Success { get; set; } = true;

        /// <summary>
        /// 返回消息
        /// </summary>
        public string Message { get; set; }

        /// <summary>
        /// 扩展字段
        /// </summary>
        public object DataExt { get; set; }

    }

    /// <summary>
    /// 返回单个对象
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ObjectRet<T> : BaseRet
    {
        /// <summary>
        /// 
        /// </summary>
        public T Data { get; set; }
    }


    /// <summary>
    /// 返回对象集合
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ListRet<T> : BaseRet
    {
        /// <summary>
        /// 
        /// </summary>
        public List<T> DataList { get; set; }
    }

    /// <summary>
    /// 返回分页对象
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class PageRet<T> : BaseRet
    {
        /// <summary>
        /// 
        /// </summary>
        public int TotalCount { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public IEnumerable<T> DataList { get; set; }
    }
}
